import { get, post } from '../http'

// --------------------------------------- 品牌管理 start --------------------------------------
// 品牌列表 /product/brand/page
export const getBrandList = (paylaod: any) => {
  return get('/product/brand/page', paylaod)
}

// 修改品牌列表状态  /product/brand/updateStatusByIds
export const updateBrandStatus = (paylaod: any) => {
  return post('/product/brand/updateStatusByIds', paylaod)
}

//新增或者修改品牌数据状态
export const saveBrandData = (paylaod: any) => {
  return post('/product/brand/saveOrUpdate', paylaod)
}

// --------------------------------------- 品牌管理 end --------------------------------------

// --------------------------------------- 计量单位管理 start --------------------------------------
// 计量单位列表
export const getUnitList = (paylaod: any) => {
  return get('/product/unit/page', paylaod)
}
// 新增或者更新计量单位
export const saveUnitData = (paylaod: any) => {
  return post('/product/unit/saveOrUpdate', paylaod)
}
// 删除计量单位
export const deleteUnitData = (paylaod: any) => {
  return post('/product/unit/delLogicByIds', paylaod)
}
// --------------------------------------- 计量单位管理 end --------------------------------------

// --------------------------------------- 产品类目 start --------------------------------------
// 产品类目列表
export const getCategoryList = (paylaod?: any) => {
  return get('/product/productCategory/listWithChild', paylaod)
}
// 删除产品类目
export const deleteCategoryList = (paylaod: any) => {
  return post('/product/productCategory/delLogicByIds', paylaod)
}
// 新增或者更新产品类目
export const saveCateGoryData = (paylaod: any) => {
  return post('/product/productCategory/saveOrUpdate', paylaod)
}
// 更新产品类目列表状态
export const updateCategoryStatus = (paylaod: any) => {
  return post('/product/productCategory/updateStatusById', paylaod)
}
// 产品类目数排序
export const getCateGoryList = (paylaod: any) => {
  return post('/product/productCategory/updateTreeSort', paylaod)
}

// --------------------------------------- 产品类目 end --------------------------------------
// --------------------------------------- 属性管理 start --------------------------------------
// 属性管理列表
export const getRelatedList = (paylaod: any) => {
  return get('/product/prop/pageRelated', paylaod)
}
// 删除
export const deleteRelatedList = (paylaod: any) => {
  return post('/product/prop/delLogicRelatedByIds', paylaod)
}
// 更新
export const updateRelatedList = (paylaod: any) => {
  return post('/product/prop/saveOrUpdateRelated', paylaod)
}
// 更新状态
export const updateRelatedListStatus = (paylaod: any) => {
  return post('/product/prop/updateStatusByIds', paylaod)
}

// 属性分组列表
export const getPropertyGroupList = () => {
  return get('/product/propGroup/list')
}
// 更新
export const updatePropertyGroupList = (paylaod: any) => {
  return post('/product/propGroup/saveOrUpdate', paylaod)
}
// 删除
export const deletePropertyGroup = (paylaod: any) => {
  return post('/product/propGroup/delLogicByIds', paylaod)
}

// 模板模板列表
export const getPropertyTemplateList = (paylaod: any) => {
  return get('/product/propTemplate/pageRelated', paylaod)
}
// 删除
export const deletePropertyTemplateList = (paylaod: any) => {
  return post('/product/propTemplate/delLogicRelatedByIds', paylaod)
}
// 更新
export const updatePropertyTemplate = (paylaod: any) => {
  return post('/product/propTemplate/saveOrUpdateRelated', paylaod)
}
// 更改状态
export const updatePropertyTemplateStatus = (paylaod: any) => {
  return post('/product/propTemplate/updateStatusByIds', paylaod)
}
// 产品类目查询属性模板
export const getPropTemplateByCateIdRec = (paylaod: any) => {
  return get('/product/propTemplate/getPropTemplateByCateIdRec', paylaod)
}
// 判断名字是否重复
export const isPropertyNameExist = (payload: any) => {
  return post('/product/prop/isNameExist', payload)
}
// --------------------------------------- 属性管理 end --------------------------------------
// --------------------------------------- 产品列表 start --------------------------------------

// spu列表
export const getProductSPUList = (paylaod: any) => {
  return get('/product/spu/pageRelated', paylaod)
}
// 创建
export const updateProductSPUList = (paylaod: any) => {
  return post('/product/spu/createOrUpdateRelated', paylaod)
}
// 删除SPu /product/spu/delPhysicalByIds
export const delProductSPUList = (paylaod: any) => {
  return post('/product/spu/delPhysicalByIds', paylaod)
}

// sku列表
export const getProductSKUList = (paylaod: any) => {
  return post('/product/sku/pageRelated', paylaod)
}
// 包装，产品 /product/sku/pageSkuRelated
export const pageSkuRelated = (paylaod: any) => {
  return post('/product/sku/pageSkuRelated', paylaod)
}
// 创建
export const updateProductSKUList = (paylaod: any) => {
  return post('/product/sku/saveOrUpdateBatchById', paylaod)
}
// 详情
export const productSKUDetail = (paylaod: any) => {
  return get(`/product/sku/getRelatedById/${paylaod}`)
}
// 产品库同步智能补货
export const syncReplenishByProduct = (payload: any) => {
  return post('/procurement/v1/intellectReplenish/syncReplenishByProduct', payload)
}
// 采购报价产品列表
export const findQuoteProductSkuPage = (payload: any) => {
  return post('/product/sku/findQuoteProductSkuPage', payload)
}
// 供应商获取-经销商产品列表
export const findDealerProductSkuPage = (payload: any) => {
  return post('/product/dealer/sku/findDealerProductSkuPage', payload)
}

// --------------------------------------- 产品列表 end --------------------------------------

// 获取sku生成规则
export const getByCompanyId = (paylaod?: any) => {
  return post('/product/genSkuConfig/getByCompanyId', paylaod)
}
// 新增或者编辑sku
export const saveOrUpdateBatchById = (paylaod: any) => {
  return post('/product/genSkuConfig/saveOrUpdateBatchById', paylaod)
}
// 根据配置生成sku
export const genSkuByConfig = (paylaod?: any) => {
  return post('/product/genSkuConfig/genSkuByConfig', paylaod)
}

// 查询SPu  http://47.113.109.101:18687/product/spu/getRelatedBySpu/test01666f9984ca6ee4fa298b9e9ffdd479a3e
export const searchSpuAndCOmpanyDetail = (paylaod?: any, companyId?: string) => {
  return get(`/product/spu/getRelatedBySpu/${paylaod}/${companyId}`)
}

export const searchSpuDetail = (paylaod?: any) => {
  return get(`/product/spu/getRelatedById/${paylaod}`)
}

// 通过SKU查询SPU(自己查询自己的公司下面的spu)
export const searchSpuDetailBySku = (paylaod?: any) => {
  return get(`/product/spu/getRelatedBySku/${paylaod}`)
}
// 通过SKU查询SPU(自己查询别人的公司下面的spu)
export const getRelatedByCompanySku = (paylaod?: any) => {
  return get(`/product/sku/getRelatedByCompanySku`, paylaod)
}

// 导入SKU /product/sku/importProducts
export const importProducts = (paylaod: any) => {
  return post('/product/sku/importProducts', paylaod, { headers: { 'Content-Type': 'multipart/form-data' } })
}

// 辅料列表
export const pageIngredient = (paylaod?: any) => {
  return post('/product/productIngredient/pageIngredient', paylaod)
}

// 创建或更新辅料
export const saveOrUpdateIngredientBatchById = (paylaod?: any) => {
  return post('/product/productIngredient/saveOrUpdateBatchById', paylaod)
}

// 删除辅料
export const delIngredientBatch = (paylaod?: any) => {
  return post('/product/productIngredient/delIngredientBatch', paylaod)
}

// 产品规格
export const pageProductSpec = (paylaod?: any) => {
  return get('/product/productSpec/pageProductSpec', paylaod)
}
// 新建或者更新产品规格
export const saveOrUpdateProductSpec = (paylaod?: any) => {
  return post('/product/productSpec/saveOrUpdateProductSpec', paylaod)
}

// 删除产品规格
export const removeProductSpec = (paylaod?: any) => {
  return post('/product/productSpec/removeProductSpec', paylaod)
}

// 查询产品规格详情
export const getProductSpecById = (paylaod?: any) => {
  return get('/product/productSpec/getProductSpecById', paylaod)
}

// 产品规格模板
export const pageProductSpecTemplate = (paylaod?: any) => {
  return get('/product/productSpecTemplate/pageProductSpecTemplate', paylaod)
}

// 新建或者更新产品规格模板
export const saveOrUpdateProductSpecTemplate = (paylaod?: any) => {
  return post('/product/productSpecTemplate/saveOrUpdateProductSpecTemplate', paylaod)
}

// 删除产品规格模板
export const removeProductSpecTemplate = (paylaod?: any) => {
  return post('/product/productSpecTemplate/removeProductSpecTemplate', paylaod)
}

// 产品标签列表
export const tagListByParam = (paylaod?: any) => {
  return get('/product/tag/listByParam', paylaod)
}
// 删除标签
export const delByIds = (paylaod?: any) => {
  return post('/product/tag/delByIds', paylaod)
}
// 更新订单标签
export const saveOrUpdateBatch = (paylaod?: any) => {
  return post('/product/tag/saveOrUpdateBatch', paylaod)
}

// 包装列表
export const pagePacking = (paylaod?: any) => {
  return post('/product/packing/pagePacking', paylaod)
}
// 创建包装
export const saveOrUpdatePack = (paylaod?: any) => {
  return post('/product/packing/saveOrUpdateBatchById', paylaod)
}
// 获取包装详情
export const packDetail = (id?: any) => {
  return get(`/product/packing/pagePacking/${id}`)
}

// 批量删除包装 /product/packing/delPacking
export const delPacking = (paylaod?: any) => {
  return post('/product/packing/delPacking', paylaod)
}
// FBA发货单查询可用包装
export const findPackingPageByFba = (paylaod?: any) => {
  return post('/product/packing/findPackingPageByFba', paylaod)
}

// 查询指定产品规格详情
export const getProductSpecByParam = (paylaod?: any) => {
  return post('/product/productSpec/getProductSpecByParam', paylaod)
}

// 根据sku查询sku详情
export const getSkuDetailBySku = (sku?: any) => {
  return get(`/product/sku/getRelatedBySku/${sku}`)
}
// 导出产品
export const exportProductSku = (paylaod?: any) => {
  return post('/product/sku/exportProductSku', paylaod)
}
// 获取所有部门列表
export const findDeptList = (paylaod?: any) => {
  return get('/user/v1/dept/findDeptList', paylaod)
}
// 查询产品
export const getProductBySkuForInnerErp = (paylaod?: any) => {
  return get('/innererp/v1/erpProduct/getProductBySku', paylaod)
}

// 导出属性带入模板
export const exportTemplate = (paylaod?: any) => {
  return post('/product/propImportTemplate/exportTemplate', paylaod)
}
// 新增或更新属性导入模板
export const saveOrUpdatePropImportTemplate = (paylaod?: any) => {
  return post('/product/propImportTemplate/saveOrUpdatePropImportTemplate', paylaod)
}
// 根据用户IDS查询属性导入模板
export const listPropImportTemplateByUserIds = (paylaod?: any) => {
  return get('/product/propImportTemplate/listPropImportTemplateByLoginUser', paylaod)
}
// 导入产品属性EXCEL
export const importProductProp = (paylaod?: any) => {
  return post('/product/propImportTemplate/importProductProp', paylaod, { headers: { 'Content-Type': 'multipart/form-data' } })
}
// wordPress 类目
export const listAllCategoryTreeByShopId = (paylaod?: any) => {
  return get('/product/wooCommerce/product/listAllCategoryTreeByShopId', paylaod)
}
// wordPress 类目创建，新增 以及编辑
export const batchCategory = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchCategory', paylaod)
}
// 绑定erp类目
export const categoryBatchCreateOrUpdateSkipNullById = (paylaod?: any) => {
  return post('/product/wooCommerce/product/categoryBatchCreateOrUpdateSkipNullById', paylaod)
}
// 类目排序
export const batchCategorySort = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchCategorySort', paylaod)
}
// wordPress 标签
export const tagRollPage = (paylaod?: any) => {
  return post('/product/wooCommerce/product/tagRollPage', paylaod)
}
// 标签的删除 新增 以及修改
export const batchTag = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchTag', paylaod)
}

// wordPress 属性
export const attributeRollPage = (paylaod?: any) => {
  return post('/product/wooCommerce/product/attributeRollPage', paylaod)
}
// 属性的删除 新增 以及修改
export const batchAttribute = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchAttribute', paylaod)
}
// 属性值的删除 新增 以及修改
export const batchAttributeTerm = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchAttributeTerm', paylaod)
}

// 属性保存erp属性
export const attributeBatchCreateOrUpdateSkipNullById = (paylaod?: any) => {
  return post('/product/wooCommerce/product/attributeBatchCreateOrUpdateSkipNullById', paylaod)
}

// wordPress 在线商品
export const saleRollPage = (paylaod?: any) => {
  return post('/product/wooCommerce/product/saleRollPage', paylaod)
}
// wordPress 删除在线商品
export const saleDeleteByIdList = (paylaod?: any) => {
  return post('/product/wooCommerce/product/saleDeleteByIdList', paylaod)
}
// wordPress 通过id查询详情
export const saleGetById = (paylaod?: any) => {
  return get('/product/wooCommerce/product/saleGetById', paylaod)
}
// 编辑在线商品基本信息
export const batchProduct = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchProduct', paylaod)
}
// 编辑在线商品变体信息
export const batchProductVariation = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchProductVariation', paylaod)
}

// 在线商品是否真是删除
export const batchDeleteProduct = (paylaod?: any) => {
  return post('/product/wooCommerce/product/batchDeleteProduct', paylaod)
}
// 刊登列表
export const versionRollPage = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionRollPage', paylaod)
}
// 创建刊登
export const versionBatchCreate = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionBatchCreate', paylaod)
}
// 刊登草稿删除
export const versionBatchDelete = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionBatchDelete', paylaod)
}
// 刊登草稿提交审核
export const versionBatchSubmitAudit = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionBatchSubmitAudit', paylaod)
}
// 刊登修改基础信息
export const versionBatchUpdate = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionBatchUpdate', paylaod)
}
// 获取刊登详情
export const versionGetById = (paylaod?: any) => {
  return get('/product/wooCommerce/product/versionGetById', paylaod)
}
// 刊登审核
export const versionBatchAudit = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionBatchAudit', paylaod)
}
// 未刊登列表
export const pageRelatedV2 = (paylaod?: any) => {
  return post('/product/spu/pageRelatedV2', paylaod)
}

// 去刊登
export const versionBatchCreateFromSpu = (paylaod?: any) => {
  return post('/product/wooCommerce/product/versionBatchCreateFromSpu', paylaod)
}

// 获取店铺列表
export const listAllUserWordPressShop = (paylaod?: any) => {
  return get('/user/v1/shop/findShopListByParam', paylaod)
}

// 删除未刊登商品数据
// export const batchUpdateSkipNullById = (paylaod?: any) => {
//   return post('/product/spu/batchUpdateSkipNullById', paylaod)
// }
// 根据id查询属性值信息
export const attributeGetById = (paylaod?: any) => {
  return get('/product/wooCommerce/product/attributeGetById', paylaod)
}

// wordPress 在线商品绑定运营
export const saleBatchUpdate = (paylaod?: any) => {
  return post('/product/wooCommerce/product/saleBatchUpdate', paylaod)
}

// 配件
export const accessoryRollPage = (paylaod?: any) => {
  return post('/product/fitting/pageFitting', paylaod)
}
// 配件的删除
export const deleteFittingByIdList = (paylaod?: any) => {
  return post('/product/fitting/deleteFittingByIdList', paylaod)
}
// 配件新增 以及修改
export const saveOrUpdateBatchFittingById = (paylaod?: any) => {
  return post('/product/fitting/saveOrUpdateBatchById', paylaod)
}
// 查询配件详情
export const pageFittingDetail = (paylaod?: any) => {
  return get(`/product/fitting/pageFitting/${paylaod}`)
}
// 供应商产品
export const rollPage = (paylaod?: any) => {
  return post('/product/supplier/product/spu/rollPage', paylaod)
}
// 批量认领
export const batchClaim = (paylaod?: any) => {
  return post('/product/supplier/product/spu/batchClaim', paylaod)
}
// 认领记录
export const findApprovalProcessPage = (paylaod?: any) => {
  return get('/user/v1/approve/process/findApprovalProcessPage', paylaod)
}
// 产品兼容SPU
export const spuPageRelatedForCompanyVer = (paylaod?: any) => {
  return get('/product/spu/pageRelatedForCompanyVer', paylaod)
}
export const spuUpdateRelatedV2 = (paylaod?: any) => {
  return post('/product/spu/updateRelatedV2', paylaod)
}
// 产品兼容SKU
export const skuPageRelatedForCompanyVer = (paylaod?: any) => {
  return post('/product/sku/pageRelatedForCompanyVer', paylaod)
}
export const skuUpdateBatchByIdV2 = (paylaod?: any) => {
  return post('/product/sku/updateBatchByIdV2', paylaod)
}

// 新增或者更新配件
export const saveOrUpdateById = (paylaod?: any) => {
  return post('/product/fitting/v2/saveOrUpdateById', paylaod)
}
// 配链列表
export const pageFitting = (paylaod?: any) => {
  return post('/product/fitting/v2/pageFitting', paylaod)
}
// 根据id列表,批量更新状态
export const batchUpdateStateByIdList = (paylaod?: any) => {
  return post('/product/fitting/v2/batchUpdateStateByIdList', paylaod)
}
// 批量更新SPU
export const batchUpdateSkipNullById = (paylaod?: any) => {
  return post('/product/spu/batchUpdateSkipNullById', paylaod)
}
